<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * 控制器基类
 */
class SDO_Controller extends Controller {

	var $uri_array = array();

	public function __construct()
	{
		parent::Controller();
		$this->uri_array	= $this->uri->uri_to_assoc();
	}

	public function uri_array($key)
	{
		if( isset($this->uri_array[$key] ) )
		{
			return $this->uri_array[$key];
		}
		return "";
	}


	/**
	 * 读取参数
	 *
	 * @param unknown_type 参数名
	 * @param unknown_type 默认值
	 * @param unknown_type 所有可取变量
	 * @return unknown
	 */
	protected function getpara( $name , $default='' , $all_data= array(), $ajax_post_deal=true )
	{
		$data= $this->uri_array( $name );
		$ajax_post_deal && $data= post_helper::ajax_post_deal($data);

		$data || $data= $this->input->post( $name )? $this->input->post( $name ): $default ;

		if( $data && !in_array($data, $all_data) && in_array(@text_helper::hex2bin( $data ), $all_data ))
		{
			$data= text_helper::hex2bin($data);
		}
		return $data;
	}

}